// https://blog.csdn.net/wangshubo1989/article/details/50300417

#include <iostream>
#include <string>
#include <map>

static enum StrValue{
    NotDefined,
    Str1,
    Str2,
    Str3
};

static std::map<std::string, StrValue> str_value_map;

void InitMap() {
    //str_value_map.insert("NotDefined", NotDefined);
    str_value_map["NotDefined"] = NotDefined;
    str_value_map["Str1"] = Str1;
    str_value_map["Str2"] = Str2;
    str_value_map["Str3"] = Str3;
}

int main() {
    std::string input;
    std::cout << "please input a string-enum\n";
    std::cin >> input;

    switch (str_value_map[input])
    {
    case Str1:
        std::cout << "str1\n";
        break;
    case Str2:
        std::cout << "str2\n";
        break;
    case Str3:
        std::cout << "str3\n";
    case NotDefined:
        std::cout << "not defined\n";
        break;
    default:
        std::cout << "invaild value!\n";
        break;
    }

    return 0;
}